let initData = {
    list: []
}

let Reducer = (state = initData, {type, payload}) => {

    switch(type) {
        case 'GET_LIST':
            return {
                ...state,
                list: payload
            }

        case 'CLICK_BTN':

            state.list[payload].flag = !state.list[payload].flag

            return {
                ...state,
                list: [...state.list]
            }

        default:
            return {
                ...state
            }
    }

}

export default Reducer